import { createStore } from 'vuex'

export default createStore({
  state: {
    userInfo: localStorage.getItem('userInfo')?JSON.parse(localStorage.getItem('userInfo')) : {},
  },
  mutations: {
    SET_USER: (state, userInfo) => {
      state.userInfo = userInfo
      localStorage.setItem('userInfo', JSON.stringify(userInfo));
    },
  },
  actions: {
  },
  modules: {
  },
  getters: {
    userInfo: state => {
      return state.userInfo;
    }
  }
})
